Skip to content

fix(bindgen,format): enable wasm encoded to be used in the bindgen! macro#12857

Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom
mkatychev:fix/bindgen-include-bytes
Mar 30, 2026
Merged

fix(bindgen,format): enable wasm encoded to be used in the bindgen! macro#12857
alexcrichton merged 2 commits intobytecodealliance:mainfrom
mkatychev:fix/bindgen-include-bytes

Conversation

@mkatychev
Copy link
Copy Markdown
Member

Use include_bytes en lieu of include_string to allow WASM encoded components to be passed into wasmtime::component::bindgen.

wit_parser::Resolve::push_path seems to already support wasm-encoded format (Added in bytecodealliance/wasm-tools#2415):

The input path can be one of:

  • ...
  • A wasm-encoded WIT package as a single file in either the text or binary format.

@mkatychev mkatychev requested a review from a team as a code owner March 27, 2026 17:43
@mkatychev mkatychev requested review from pchickey and removed request for a team March 27, 2026 17:43
@mkatychev
Copy link
Copy Markdown
Member Author

Couple of questions came up with this PR:

  • should test cases be included in this PR or should that be handled upstream (this PR mainly exposes further the functionality of wit-parser)

  • The wit-bindgen Config::expand method has already handled this case and is almost identical to the current bindgen::expand function (barring an extra rustfmt process in wasmtime), has there already been discussions about their similarity and possible reuse?

Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexcrichton
Copy link
Copy Markdown
Member

should test cases be included in this PR or should that be handled upstream

Ah this is fine as-is, it's more-or-less well-tested already and relaxing to bytes I think is reasonable to have without a test.

has there already been discussions about their similarity and possible reuse?

nope, just some old code and you're witnessing how things evolved over time :)

If you'd like to help clean up with a PR that'd be much appreciated!

@alexcrichton alexcrichton added this pull request to the merge queue Mar 30, 2026
Merged via the queue into bytecodealliance:main with commit 4ad29c7 Mar 30, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants